package cn.whao.guli.stock.service.impl;

import cn.whao.guli.stock.mapper.StockMapper;
import cn.whao.guli.stock.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * ClassName: StockServiceImpl
 * Package: cn.whao.guli.stock.service.impl
 * Description:
 *
 * @Author 王豪
 * @Create 2024/11/26 15:51
 * @Version 1.0
 */
@Service
public class StockServiceImpl implements StockService {

    @Resource
    private StockMapper stockMapper;

    @Override
    public Boolean updateStockByProductId(String productId, Integer count) {
        /*try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }*/
        return stockMapper.updateCountByProductId(productId, count) == 1;
    }
}
